package com.ybwh.springboot2;

import com.sankuai.inf.leaf.plugin.annotation.EnableLeafServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;


/**
 *
 * SpringBootApplication上使用@ServletComponentScan注解后，
 * Servlet、Filter、Listener可以直接通过@WebServlet、@WebFilter、@WebListener注解自动注册，无需其他代码。
 *
 * EnableAspectJAutoProxy :Aop可以将代理对象暴露到当前线程局部变量中;
 *
 * @author ybwh
 */
@Slf4j
@EnableLeafServer
@SpringBootApplication
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true)
public class LeafIdApp {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(LeafIdApp.class, args);

		log.error("----------------error-----------------");
		log.warn("----------------warn-----------------");
		log.info("----------------info-----------------");
		log.debug("----------------debug-----------------");
		log.trace("----------------trace-----------------");
		System.out.println();

		String configPath = context.getEnvironment().getProperty("spring.config.location");
		String tomcatPort = context.getEnvironment().getProperty("server.port");
		System.out.println(configPath + "," + tomcatPort);

	}
}
